@extends('layouts.home')
@section('content')
    <div class="card">
        <div class="card-header">
            用户管理
        </div>
        <div class="card-block">
            <table class="table">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>昵称</th>
                    <th>邮箱</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($users as $v)
                <tr>
                    <td scope="row">{{$v['id']}}</td>
                    <td>{{$v['username']}}</td>
                    <td>{{$v['email']}}</td>
                    <td>
                        <a href="{{route('user.show',['id' => $v['id']])}}" class="btn btn-outline-primary">查看</a>
                    @can('update',$v)
                        <a href="{{route('user.edit',['id' => $v['id']])}}" class="btn btn-outline-success">编辑</a>
                        @endcan
                        @can('delete',$v)
                        <form action="{{route('user.destroy',['id'=>$v['id']])}}" method="post">
                            @csrf
                            @method('DELETE')
                            <button type="submit" class="btn btn-outline-danger">删除</button>
                        </form>
                        @endcan
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
        </div>
        <div class="card-footer text-muted">
            {{$users->links()}}
        </div>
    </div>
@endsection